<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<style>
  html, body { height: 10000px; }
</style>
<h1>doc.write() to iframe should not cause scrolling of the parent</h1>
<script>
  var t = async_test('doc.write() to iframe should not cause ' +
                     'scrolling of the parent');
  var isFirstTime = true;

  function doTest() {
    if (!isFirstTime)
      return;
    isFirstTime = false;

    requestAnimationFrame(t.step_func(function() {
      var iframe = document.getElementById('iframe');
      var doc = iframe.contentWindow.document;
      doc.open();
      doc.write("Hello");
      doc.close();

      assert_equals(scrollY, 0);
      t.done();
    }));
  }

  if (!location.href.endsWith('#')) {
    location.href += '#';
  }
</script>
<iframe id="iframe" onload="doTest()"></iframe>
